<script type="text/javascript">
$(document).ready(function() {
	
	Group.validate();
	 var value = $("input:radio[name='chap']:checked").val();
		if(value==0){
			$(".incoming").css('display','none');
			$(".outgoing").css('display','none');
			$("#incoming_user").val("");
			$("#incoming_password").val("");
			$("#outgoing_user").val("");
			$("#outgoing_password").val("");
		}
		if(value==1){
			$(".incoming").css('display','');
			$(".outgoing").css('display','none');
			 $("#outgoing_user").val("");
			 $("#outgoing_password").val("");
		}
		if(value==2){
			$(".incoming").css('display','');
			$(".outgoing").css('display','');
		}
});

$("input:radio[name='chap']").change(function() {
	Group.checkInput();
	var value = $("input:radio[name='chap']:checked").val();
		if(value==0){
			$(".incoming").css('display','none');
			$(".outgoing").css('display','none');
			$("#incoming_user").val("");
			$("#incoming_password").val("");
			$("#outgoing_user").val("");
			$("#outgoing_password").val("");
		}
		if(value==1){
			$(".incoming").css('display','');
			$(".outgoing").css('display','none');
			 $("#outgoing_user").val("");
			 $("#outgoing_password").val("");
		}
		if(value==2){
			$(".incoming").css('display','');
			$(".outgoing").css('display','');
		}
		$("#editHgDialog").dialog("resize");
});
</script>
<form method="post" id="editGroupForm"
	action="${basePath}/mapping/hg/save">
	<div class="main_Receipt_table" id="base">
		<input id="id" type="hidden" name="id" value="${hg.id!}" />
		<div class="main_Receipt_table_m">
			<table id="editGroupTable" border="0" cellspacing="0" cellpadding="0">
				<tbody>
					<tr>
						<th style="width: 30%;" scope="row"><@spring.message code='group.name'/><span
							class="color_red">*</span></th>
						<td style="width: 70%;"><input id="groupName" type="text" name="name" value="${hg.name!}" onchange=""/></td>
					</tr>
					<tr>
						<th style="width: 30%;"><@spring.message code='group.identify.chap'/></th>
						<td style="width:70%">
							<input style="width:15%" type="radio" name="chap" value="0" <#if hg.chap_type==0> checked="checked"</#if>/><@spring.message code='group.identify.disable'/>
							<input style="width:15%" type="radio" name="chap" value="1" <#if hg.chap_type==1> checked="checked"</#if>/><@spring.message code='group.identify.one_way'/>
							<input style="width:15%" type="radio" name="chap" value="2" <#if hg.chap_type==2> checked="checked"</#if>/><@spring.message code='group.identify.two_way'/>
						</td>
					</tr>
					
					<tr class="incoming" style="display:none">
						<th style="width: 30%;" scope="row"><@spring.message code='group.incoming_user'/><span class="color_red">*</span></th>
						<td style="width: 70%;"><input type="text" id='incoming_user' value="${hg.incoming_user!}"/></td>
					</tr>
					<tr class="incoming" style="display:none">
						<th style="width: 30%;" scope="row"><@spring.message code='group.incoming_pass'/><span class="color_red">*</span></th>
						<td style="width: 70%;"><input type="password" id='incoming_password' value="${hg.incoming_password!}"/></td>
					</tr>
					
					<tr class="outgoing" style="display:none">
						<th style="width: 30%;" scope="row"><@spring.message code='group.outgoing_user'/><span class="color_red">*</span></th>
						<td style="width: 70%;"><input type="text" id='outgoing_user' value="${hg.outgoing_user!}"/></td>
					</tr>
					<tr class="outgoing" style="display:none">
						<th style="width: 30%;" scope="row"><@spring.message code='group.outgoing_pass'/><span class="color_red">*</span></th>
						<td style="width: 70%;"><input type="password" id='outgoing_password' value="${hg.outgoing_password!}"/></td>
					</tr>
					
				</tbody>
			</table>
		</div>
	</div>
</form>
